﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;

namespace MvcWiki.Test.User
{
    public class WikiUserProviderBaseFacts
    {
        [Fact]
        public void Create()
        {
            new MvcWiki.User.WikiUserProviderBase();
        }

        [Fact]
        public void CanCreateNamespace_Returns_True()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();

            Assert.True(wikiUserProvider.CanCreateNamespace());
        }

        [Fact]
        public void CanIndexNamespaces_Returns_True()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();
            var wikiNamespace = new MvcWiki.Model.WikiNamespace();

            Assert.True(wikiUserProvider.CanIndexNamespaces());
        }

        [Fact]
        public void CanEditNamespace_Returns_True()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();
            var wikiNamespace = new MvcWiki.Model.WikiNamespace();

            Assert.True(wikiUserProvider.CanEditNamespace(wikiNamespace));
        }

        [Fact]
        public void CanEditNamespace_Throws_Exception_For_Null()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();

            Assert.Throws<ArgumentNullException>(() => wikiUserProvider.CanEditNamespace(null));
        }

        [Fact]
        public void CanViewNamespace_Returns_True()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();
            var wikiNamespace = new MvcWiki.Model.WikiNamespace();

            Assert.True(wikiUserProvider.CanViewNamespace(wikiNamespace));
        }

        [Fact]
        public void CanViewNamespace_Throws_Exception_For_Null()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();

            Assert.Throws<ArgumentNullException>(() => wikiUserProvider.CanViewNamespace(null));
        }

        [Fact]
        public void CanDeleteNamespace_Returns_True()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();
            var wikiNamespace = new MvcWiki.Model.WikiNamespace();

            Assert.True(wikiUserProvider.CanDeleteNamespace(wikiNamespace));
        }

        [Fact]
        public void CanDeleteNamespace_Throws_Exception_For_Null()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();

            Assert.Throws<ArgumentNullException>(() => wikiUserProvider.CanDeleteNamespace(null));
        }

        [Fact]
        public void CanCreatePage_Returns_True()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();

            Assert.True(wikiUserProvider.CanCreatePage());
        }

        [Fact]
        public void CanIndexPages_Returns_True()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();
            var wikiNamespace = new MvcWiki.Model.WikiNamespace();

            Assert.True(wikiUserProvider.CanIndexPages(wikiNamespace));
        }

        [Fact]
        public void CanIndexPages_Throws_Exception_For_Null()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();

            Assert.Throws<ArgumentNullException>(() => wikiUserProvider.CanIndexPages(null));
        }

        [Fact]
        public void CanEditPage_Returns_True()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();
            var wikiPage = new MvcWiki.Model.WikiPage();

            Assert.True(wikiUserProvider.CanEditPage(wikiPage));
        }

        [Fact]
        public void CanEditPage_Throws_Exception_For_Null()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();

            Assert.Throws<ArgumentNullException>(() => wikiUserProvider.CanEditPage(null));
        }

        [Fact]
        public void CanViewPage_Returns_True()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();
            var wikiPage = new MvcWiki.Model.WikiPage();

            Assert.True(wikiUserProvider.CanViewPage(wikiPage));
        }

        [Fact]
        public void CanViewPage_Throws_Exception_For_Null()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();

            Assert.Throws<ArgumentNullException>(() => wikiUserProvider.CanViewPage(null));
        }

        [Fact]
        public void CanDeletePage_Returns_True()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();
            var wikiPage = new MvcWiki.Model.WikiPage();

            Assert.True(wikiUserProvider.CanDeletePage(wikiPage));
        }

        [Fact]
        public void CanDeletePage_Throws_Exception_For_Null()
        {
            var wikiUserProvider = new MvcWiki.User.WikiUserProviderBase();

            Assert.Throws<ArgumentNullException>(() => wikiUserProvider.CanDeletePage(null));
        }
    }
}
